using Godot;
using System;
using System.Reflection.Metadata;

public partial class Coin : Area2D
{
   private GameManager gameManager;
   private AnimationPlayer AnimationPlayerNode;
   public override void _Ready()
   {
      gameManager = GetNode<GameManager>("/root/GameManager");
      AnimationPlayerNode = GetNode<AnimationPlayer>("AnimationPlayer");
      BodyEntered += HandleBodyEntered;
   }

   private void HandleBodyEntered(Node2D body)
   {
      gameManager.AddPoint();
      AnimationPlayerNode.Play("Pickup");
   }
}
